/******************************************************************************/
//	ObjectBase.cpp	-	Provides base functionality for all objects
/******************************************************************************/

#include "ObjectBase.h"
#include <iostream>
using namespace std;

CObjectBase::CObjectBase()
{	
	// TODO: assign a unique id to each object as nObjectId
	// HINT: use a static variable...
	static int idVar = 0;
	m_nObjectId = idVar;
	idVar++;

	m_nFlags = 0;
}

CObjectBase::~CObjectBase()
{
}

bool CObjectBase::EnQueueEvent(Event * pEvent)
{
	return false;
}


void CObjectBase::RemoveFlags(int nMask)
{
	// TODO: turn off bit(s) 
	// Note: If the bits were already off, this should not turn it on, in other words, do not "toggle".
	m_nFlags &= ~(nMask);
}


void CObjectBase::AddFlags(int nMask)
{
	// TODO: turn on bit(s)
	// Note: If the bits are already on, this should not turn it off, in other words, do not "toggle".
	m_nFlags |= nMask;
}


bool CObjectBase::AreFlagsSet(int nMask)
{
	// TODO: determine if the nMask bit(s) are set in this class object. 
	// Note: this needs to handle single or multi bit testing. NO For loops allowed, use bit operators!
	// Example:  1101 ->existing flags in this class object that are set
	//           0011 ->testBits
	//           ---- ->AreFlagsSet?
	//           ???? ->No, return FALSE for this example because only 1 out of the 2 testBits were set
	if((m_nFlags & nMask) == nMask)
		return true;

	return false;
}